package com.ruoyi.social.service.impl;

import java.util.List;

import com.alibaba.fastjson2.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.social.mapper.SocialShopMapper;
import com.ruoyi.social.domain.SocialShop;
import com.ruoyi.social.service.ISocialShopService;

/**
 * 店铺数据Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-24
 */
@Service
public class SocialShopServiceImpl implements ISocialShopService 
{
    @Autowired
    private SocialShopMapper socialShopMapper;

    /**
     * 查询店铺数据
     * 
     * @param id 店铺数据主键
     * @return 店铺数据
     */
    @Override
    public SocialShop selectSocialShopById(Long id)
    {
        return socialShopMapper.selectSocialShopById(id);
    }

    @Override
    public SocialShop selectSocialShopByOutId(String outId) {
        return socialShopMapper.selectSocialShopByOutId(outId);
    }


    @Override
    public void processorShopStart(String url, String channel) {
//        Long userId = SecurityUtils.getUserId();
//        VideoPoints points = pointsService.selectVideoPointsByUserId(userId);
//        if (points.getPoints() < SystemPointConfig.PRODUCT_POINT) {
//            // 积分不足
//            throw new I18nException("point.insufficient");
//        }
//        SocialProduct product = socialProductMapper.selectSocialProductByLink(url);
//        if (StringUtils.isNotNull(product)
//                && product.getProductInfoUpdateData().after(DateUtils.addHours(new Date(), -24))) {
//            // 数据已经存在并且 更新日期是一天以以内
//            Boolean isnew = productUserService.checkSocialProductUser(userId, product.getId());
//            if (isnew) {
//                changePoint( url, points);
//            }
//        } else {
//            processorProduct(processorService.getFullRequest(url, channel));
//            changePoint( url, points);
//        }
    }

    @Override
    public void processorShopEnd(Long id, JSONObject jsonObject) {

    }

    /**
     * 查询店铺数据列表
     * 
     * @param socialShop 店铺数据
     * @return 店铺数据
     */
    @Override
    public List<SocialShop> selectSocialShopList(SocialShop socialShop)
    {
        return socialShopMapper.selectSocialShopList(socialShop);
    }

    /**
     * 新增店铺数据
     * 
     * @param socialShop 店铺数据
     * @return 结果
     */
    @Override
    public int insertSocialShop(SocialShop socialShop)
    {
        return socialShopMapper.insertSocialShop(socialShop);
    }

    /**
     * 修改店铺数据
     * 
     * @param socialShop 店铺数据
     * @return 结果
     */
    @Override
    public int updateSocialShop(SocialShop socialShop)
    {
        return socialShopMapper.updateSocialShop(socialShop);
    }

    /**
     * 批量删除店铺数据
     * 
     * @param ids 需要删除的店铺数据主键
     * @return 结果
     */
    @Override
    public int deleteSocialShopByIds(Long[] ids)
    {
        return socialShopMapper.deleteSocialShopByIds(ids);
    }

    /**
     * 删除店铺数据信息
     * 
     * @param id 店铺数据主键
     * @return 结果
     */
    @Override
    public int deleteSocialShopById(Long id)
    {
        return socialShopMapper.deleteSocialShopById(id);
    }
}
